From: Christian Limpach Date: Thu, 12 Oct 2006 10:26:07 +0000 (+0100) Subject: [xenstore] Don't create a transaction for singleton read/write operations. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15615^2~14 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5292dab2f06bb61236d0d6cc6fc0fec66e2607eb;p=xen.git [xenstore] Don't create a transaction for singleton read/write operations. Signed-off-by: Christian Limpach --- diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c index 811c6acb6a..c34dcbfc70 100644 --- a/tools/xenstore/xenstore_client.c +++ b/tools/xenstore/xenstore_client.c @@ -267,12 +267,13 @@ int main(int argc, char **argv) { struct xs_handle *xsh; - xs_transaction_t xth; + xs_transaction_t xth = XBT_NULL; int ret = 0, socket = 0; int prefix = 0; int tidy = 0; int upto = 0; int recurse = 0; + int transaction; while (1) { int c, index = 0; @@ -339,18 +340,28 @@ main(int argc, char **argv) } #endif +#if defined(CLIENT_read) + transaction = (argc - optind) > 1; +#elif defined(CLIENT_write) + transaction = (argc - optind) > 2; +#else + transaction = 1; +#endif + xsh = socket ? xs_daemon_open() : xs_domain_open(); if (xsh == NULL) err(1, socket ? "xs_daemon_open" : "xs_domain_open"); again: - xth = xs_transaction_start(xsh); - if (xth == XBT_NULL) - errx(1, "couldn't start transaction"); + if (transaction) { + xth = xs_transaction_start(xsh); + if (xth == XBT_NULL) + errx(1, "couldn't start transaction"); + } ret = perform(optind, argc, argv, xsh, xth, prefix, tidy, upto, recurse); - if (!xs_transaction_end(xsh, xth, ret)) { + if (transaction && !xs_transaction_end(xsh, xth, ret)) { if (ret == 0 && errno == EAGAIN) { output_pos = 0; goto again;